var JS_PATH = "http://localhost:8080/EasyWeb/js/front/";
var CSS_PATH = "http://localhost:8080/EasyWeb/css/front/";
var BASE_PATH = "http://localhost:8080/EasyWeb";

$(function(){
	$("body").on('click','.tag >span',function(){
		var id = $(this).attr('name');
		window.location.href=BASE_PATH+"/tag/1/"+id+".html";
	});
});
/**
 *将语句裁剪未指定长度的文字，后面跟... 
 * @param len
 * @param words
 * @returns
 */
function cutWords(len,words){
	var reg = /[\u4E00-\u9FA5\uF900-\uFA2D]/;
	var str = "";
	if(words&&words.length>len){
		words = words.replace(new RegExp("<","g"),"&lt;");
		words = words.replace(new RegExp(">","g"),"&gt;");
		//汉字的长度加上字母长度的2倍
		var word1 = 0;
		var word2 = 0;
		for(var i = 0; i < words.length;i++){
			var word = words.substr(i,1);
			if(reg.test(word)){
				//全角
				word1++;
			}else{
				word2+=1;
				if(word2%2==0){
					word1++;
				}
			}
			if(word1==len||i==words.length-1){
				str = words.substr(0,i+1)+"...";
				break;
			}
		}
	}else{
		str = words;
	}
	return str;
}